package com.hose.util;

import cn.hutool.setting.Setting;

public class ConfigUtils {

    public final static Setting setting;

    static {
//        setting = new Setting("app.properties");
        setting = new Setting("app.properties");
    }

    /**
     * 获取用户名
     * @return
     */
    public static String getUserName() {
        return setting.getStr("user.name");
    }

    public static String getPwd() {
        return setting.getStr("user.password");
    }

    //    user.name="15810684193"
//    user.password="Go123456789"
//    user.enterprise="【测试】2022原生UI自动化测试企业"
    public static String getEnterprise() {
        return setting.getStr("user.enterprise");
    }
//    user.real_name="贾老师"
    public static String getUserRealName() {
        return setting.getStr("user.real_name");
    }

//            # company:
//    company.corp_id="mKj3IBktwl4sCg"
    public static String getCorpId() {
        return setting.getStr("company.corp_id");
    }

//    company.home_page="/web/app.html?corpId=mKj3IBktwl4sCg"
    public static String getHomePage() {
        return setting.getStr("company.home_page");
    }

//    company.phone_home_page="/applet/app.html?corpId=mKj3IBktwl4sCg"
    public static String getPhoneHomePage() {
        return setting.getStr("company.phone_home_page");
    }

//    company.appKey="15d8bacb-e9dc-4d26-a8bb-ff1e2e46b307"
    public static String getCompanyAppKey() {
        return setting.getStr("company.appKey");
    }

//    company.appSecurity="105c45c5-a839-4ca1-8d8b-e52f8e1f4e24"
    public static String getCompanyAppSecurity() {
        return setting.getStr("company.appSecurity");
    }
//    company.base_url="https://app.ekuaibao.com"
    public static String getBaseUrl() {
        return setting.getStr("company.base_url");
    }

//            # aifapiao:
//    aifapiao.invoice_id="013002000113"
    public static String getAifapiaoInvoiceId() {
        return setting.getStr("aifapiao.invoice_id");
    }

//    aifapiao.invoice_name="君信工程项目"
    public static String getAifapiaoInvoiceName() {
        return setting.getStr("aifapiao.invoice_name");
    }
//    aifapiao.invoice_corp="河北君信工程项目管理有限公司威县分公司"
    public static String getAifapiaoInvoiceCorp() {
        return setting.getStr("aifapiao.invoice_corp");
    }
//            # second_user:
//    second_user.name="18632897309"
    public static String getSecondUserName() {
        return setting.getStr("second_user.name");
    }
//    second_user.password="Zzh-321-321"
    public static String getSecondUserPwd() {
        return setting.getStr("second_user.password");
    }

//    second_user.enterprise="【测试】2022原生UI自动化测试企业"
    public static String getSecondUserEnterprise() {
        return setting.getStr("second_user.enterprise");
    }

//    second_user.real_name="臧淘淘"
    public static String getSecondUserRealName() {
        return setting.getStr("second_user.real_name");
    }

    /**
     * 获取字符串型属性值 无值或获取错误返回null
     * Params:
     * key – 属性名
     * Returns:
     * 属性值
     */
    public static String getStr(String key) {
        return setting.getStr(key);
    }

    /**
     * 获取字符串型属性值<br>
     * 若获得的值为不可见字符，使用默认值
     *
     * @param key          属性名
     * @param defaultValue 默认值
     * @return 属性值，无对应值返回defaultValue
     */
    public static String getStr(String key, String defaultValue) {
        return setting.get(key, defaultValue);
    }

}
